Skip to content

feat(security): launch Penetration Tests epic across app, API lifecycle, and provider integration#2193

Merged
claudfuen merged 37 commits intomainfrom
codex/security-vuln-reports-module
Mar 2, 2026
Merged

feat(security): launch Penetration Tests epic across app, API lifecycle, and provider integration#2193
claudfuen merged 37 commits intomainfrom
codex/security-vuln-reports-module

Conversation

@claudfuen
Copy link
Copy Markdown
Contributor

@claudfuen claudfuen commented Feb 27, 2026

Summary

This PR ships the new Security → Penetration Tests capability end-to-end.

It introduces a complete one-time penetration test lifecycle:

  • create run
  • mocked checkout handoff/return (temporary)
  • queue/progress visibility
  • run detail page
  • markdown/PDF artifact access

Final architecture

  • Frontend calls the existing Comp API client.
  • Nest API exposes dedicated penetration-test endpoints.
  • Nest API integrates directly with Maced.
  • No Next.js API proxy routes are used for this feature.

User flow

  1. User opens Security → Penetration Tests.
  2. User submits a target URL (and optional repo URL).
  3. Frontend calls POST /v1/security-penetration-tests.
  4. API creates a provider run at Maced and stores org ownership mapping (organizationId + providerRunId).
  5. User sees the run in list/detail pages with in-progress polling.
  6. On completion, user can access markdown and PDF report artifacts.

Canonical provider contract

  • Maced canonical run identifier is id (no compatibility fallback path in Comp for runId).
  • Comp stores ownership against providerRunId mapped from provider id.
  • Webhook completion/failure payload handling is aligned to provider id.

What changed

Frontend (apps/app)

  • Added Security pages:
    • /:orgId/security
    • /:orgId/security/penetration-tests
    • /:orgId/security/penetration-tests/:reportId
    • /:orgId/security/penetration-tests/checkout
  • Added polished empty/list/detail states for penetration tests.
  • Added SWR hooks and feature-specific client contracts:
    • usePenetrationTests
    • usePenetrationTest
    • usePenetrationTestProgress
    • useCreatePenetrationTest
  • Added artifact actions on detail page:
    • markdown view
    • PDF download
  • Added Security nav/search integration in app shell.
  • Added PostHog UI/route gating via is-security-enabled.

Backend (apps/api)

  • Added dedicated module:
    • SecurityPenetrationTestsModule
  • Added endpoints:
    • GET /v1/security-penetration-tests
    • POST /v1/security-penetration-tests
    • GET /v1/security-penetration-tests/:id
    • GET /v1/security-penetration-tests/:id/progress
    • GET /v1/security-penetration-tests/:id/report
    • GET /v1/security-penetration-tests/:id/pdf
    • POST /v1/security-penetration-tests/webhook
  • Added Maced client utility with strict Zod validation for provider request/response contracts.
  • Added strict org ownership enforcement on list/get/progress/artifact APIs.
  • Added webhook handshake + token verification + idempotency tracking.

Database (packages/db)

  • Added ownership mapping model/table:
    • SecurityPenetrationTestRun
    • table: security_penetration_test_runs
  • Ownership mapping key:
    • organizationId + providerRunId (unique)

Docs (packages/docs)

  • Added customer-facing Penetration Tests docs page.
  • Updated OpenAPI docs for penetration-test route and schema names.

Environment variables

Required

Variable Service Purpose
MACED_API_KEY apps/api API key for Nest API to call Maced provider endpoints.

Optional

Variable Service Default Purpose
MACED_API_BASE_URL apps/api https://api.maced.ai Override Maced base URL (staging/dev/custom).
SECURITY_PENETRATION_TESTS_WEBHOOK_URL apps/api none Base callback URL used to build webhook target for new runs.

Notes:

  • is-security-enabled is a PostHog feature flag (not an env var).
  • No feature-specific frontend env vars are required.

Rollout

  • Security tab and Security routes are gated in product UI by PostHog flag:
    • is-security-enabled

Out of scope (intentional)

  • Live Stripe checkout + reconciliation (current flow uses mocked checkout).

Risk/cost note

  • Each provider generation has meaningful token cost.
  • Generation remains explicit user-driven one-time submit (no automatic recurring runs).

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Mar 2, 2026 8:09pm
portal Ready Ready Preview, Comment Mar 2, 2026 8:09pm

Request Review

@vercel vercel bot temporarily deployed to Preview – portal February 27, 2026 01:58 Inactive
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb7a64de99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2df06e6b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@vercel vercel bot temporarily deployed to Preview – portal February 27, 2026 02:34 Inactive
@claudfuen claudfuen changed the title Add security vulnerability reports feature with API-backed queue feat(security): add security vulnerability reports module and checkout lifecycle Feb 27, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e4c528f51

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a1e273ab0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be16674dad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 789fb5eb34

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@vercel vercel bot temporarily deployed to Preview – portal March 2, 2026 17:17 Inactive
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7273e28c53

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@vercel vercel bot temporarily deployed to Preview – portal March 2, 2026 18:48 Inactive
@vercel vercel bot temporarily deployed to Preview – app March 2, 2026 18:48 Inactive
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77ab81e683

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49f6031f4d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b91d508b9e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +209 to +210
if (response.status < 200 || response.status >= 300) {
throw new Error(response.error ?? `Request failed with status ${response.status}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Surface provider error details on create failures

This branch throws response.error, but the browser API client currently only populates that field from data.message (not data.error), while the new penetration-test backend paths commonly return errors as { "error": ... } (for example in security-penetration-tests.service.ts). In those cases users get a generic HTTP 4xx message instead of the real validation/provider error, which makes create-run failures hard to diagnose and breaks the UX expected by this flow.

Useful? React with 👍 / 👎.

@claudfuen
Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 1.87.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants